package com.ruoyi.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/*
    2022/4/8 20:52
    @author ZW
    Project Name:ruoyi
     
*/
@Configuration
public class WebMVCConfig implements WebMvcConfigurer {
    /**
     * 配置跨域
     * @param registry
     */
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        //跨域配置：前端是8082端口，后端是80
        //要允许8082访问接口服务
        registry.addMapping("/**").allowedOrigins("http://localhost:8082/book");
    }

}
